package com.itheima.d4_proxy;

public class Demo {
    public static void main(String[] args) {
        BaoQiang baoQiang = new BaoQiang();
        SongJiJi songJiJi = new SongJiJi(baoQiang);
        songJiJi.LiveShow(100000);
        songJiJi.sleep();
    }

}
//代理对象
class SongJiJi implements Star{
    BaoQiang baoQiang;

    public SongJiJi(BaoQiang baoQiang) {

        this.baoQiang = baoQiang;
    }

    @Override
    public double LiveShow(double money) {
        System.out.println("拉宝强参加了一场真人秀赚了"+money);
        double v = baoQiang.LiveShow(money * 0.1);
        System.out.println("宋吉吉把宝强赚的"+v+"存起来");
        return v;
    }

    @Override
    public void sleep() {
        System.out.println("宋吉吉给宝强订酒店");
        baoQiang.sleep();
        System.out.println("宝强睡醒宋吉吉去睡马蓉");

    }
}
class BaoQiang implements Star{

    @Override
    public double LiveShow(double money) {
        System.out.println("宝强参加真人秀，赚了"+money);
        return money;
    }

    @Override
    public void sleep() {
        System.out.println("宝强累累要睡马蓉");

    }
}

interface Star{
    double LiveShow(double money);
    void sleep();
}